package com.itheima.ui;

import com.itheima.service.IAccountService;
import com.itheima.service.impl.AccountServiceImpl;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

/**
 * 获取spring核心容器
 */
public class Client {
    /**
     * @param args
     */
    public static void main(String[] args) {
        //获取核心容器
        /*ApplicationContext ac = new ClassPathXmlApplicationContext("bean.xml");*/
        ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("bean.xml");
        //根据id获取bean对象
        IAccountService as = (IAccountService) ac.getBean("accountService");
        IAccountService as1 = (IAccountService) ac.getBean("accountService");
        /*System.out.pcrintln(as==as1);*/
        as.saveAccount();
        ac.close();
    }
}
